#include <gtk/gtk.h>
#include "about.h"
#include "common.h"
#include "pic_black25.h"
#include "pic00.h"

gboolean button_press_callback(GtkWidget *widget, GdkEventButton *event, GdkWindowEdge edge);

int main(int argc,char *argv[])
{
    GtkWidget *window;
    GdkColor color_black_ = {0x0, 0x0, 0x0, 0x0};
    GdkPixbuf *pix = NULL;
    GtkWidget *image = NULL;

    gtk_init(&argc,&argv);
    
    /* create the main, top level, window */
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    
    /* give it the title */
    gtk_window_set_title(GTK_WINDOW(window), TITLE);
    
#if 1
//    gtk_window_set_decorated(GTK_WINDOW(window), FALSE);	/*设置不提供装饰*/
    gtk_window_set_default_size(GTK_WINDOW(window), 230, 150);	/*设置窗口大小*/
    gtk_widget_add_events(window, GDK_BUTTON_PRESS_MASK);
    g_signal_connect(G_OBJECT(window), "button-press-event", G_CALLBACK(button_press_callback), NULL);
#else
    gtk_window_fullscreen(GTK_WINDOW(window));	/*设置全屏*/
#endif

    gtk_widget_modify_bg(window, GTK_STATE_NORMAL, &color_black_); /*设置为黑色背景*/


    //pix = gdk_pixbuf_new_from_inline(2088960 + 24, about_pixbuf, TRUE, NULL);
    //pix = gdk_pixbuf_new_from_inline(1800 + 24, PIC_BLACK25, TRUE, NULL);
    pix = gdk_pixbuf_new_from_inline(8100+ 24, PIC00, TRUE, NULL);
    image = gtk_image_new_from_pixbuf(pix);
    gtk_container_add(GTK_CONTAINER(window), image);

    g_signal_connect(window,"destroy",G_CALLBACK(gtk_main_quit),NULL);
    /* make sure that everything, window and label, are visible */
    gtk_widget_show_all(window);
    
    /* start the main loop, and let it rest until the application is closed */
    gtk_main();
    
    return 0;
} 


gboolean button_press_callback(GtkWidget *widget, GdkEventButton *event, GdkWindowEdge edge)
{
    if (event->type == GDK_BUTTON_PRESS) {
        if (event->button == 1) {
            gtk_window_begin_move_drag(
                        GTK_WINDOW(gtk_widget_get_toplevel(widget)),
                        event->button,
                        event->x_root,
                        event->y_root,
                        event->time);
        }
    }
    return FALSE;
}
